package cn.gd.service.Document;

import cn.gd.mapper.Document.DocumentMapper;
import cn.gd.pojo.DocumentTool.DocumentVo;
import cn.gd.pojo.Documentrecyclebin;
import cn.gd.pojo.Documents;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wyh
 * @version 1.80
 */
@Service
public class DocumentServiceImpl implements DocumentService{

    @Autowired
    private DocumentMapper documentMapper;

    @Override
    public PageInfo<Documents> documentGetAll(Integer pageNo, Integer pageSize, DocumentVo documentVo) {
        PageHelper.startPage(pageNo,pageSize);
        List<Documents> list = documentMapper.getDocumentAll(documentVo);
        return new PageInfo<>(list);
    }

    @Override
    public int documentAdd(Documents documents) {
        return documentMapper.addDocument(documents);
    }

    @Override
    public Documents documentGetId(Integer id) {
        return documentMapper.getDocumentId(id);
    }

    @Override
    public int documentUpdate(Documents documents) {
        return documentMapper.updateDocument(documents);
    }

    @Override
    public int documentDelete(Integer id) {
        return documentMapper.deleteDocument(id);
    }

    @Override
    public int documentrecyclebinAdd(Documentrecyclebin documentrecyclebin) {
        return documentMapper.addDocumentrecyclebin(documentrecyclebin);
    }


}
